//
//  IdeaCollectionViewCell.m
//  LiangYa_BObject
//
//  Created by dllo on 15/10/28.
//  Copyright © 2015年 YuHao. All rights reserved.
//

#import "IdeaCollectionViewCell.h"

@implementation IdeaCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.myImageView = [[UIImageView alloc] init];
        self.myImageView.backgroundColor = [UIColor colorWithRed:0.1 green:0.2 blue:0.5 alpha:0.8];
        self.myImageView.translatesAutoresizingMaskIntoConstraints = NO;
        [self.contentView addSubview:self.myImageView];
        
        self.myvisualEffectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
        self.myvisualEffectView.backgroundColor = [UIColor colorWithWhite:0.9 alpha:0.7];
        [self.contentView addSubview:self.myvisualEffectView];
        
        self.myLabel = [[NightLabel alloc] init];
        self.myLabel.textAlignment = NSTextAlignmentLeft;
        self.myLabel.backgroundColor = [UIColor clearColor];
        self.myLabel.textColor = [UIColor whiteColor];
        self.myLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:self.myLabel];
    }
    return self;
}


- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    
    _myImageView.frame = CGRectMake(0, 0, cellWidth, cellHeight);
    
    _myLabel.frame = CGRectMake(5, cellHeight - 20, cellWidth - 10, 20);
    
    _myvisualEffectView.frame = CGRectMake(0, cellHeight - 20, cellWidth, 20);
}



@end
